/*---------------------------------------------------------------------
 * File name: RegistersX.cs
 *
 * Copyright (c) <2020-2022>, <ChenLong>
 *
 * All rights reserved.
 *
 * Author: ChenLong
 * Email: worldlong@foxmail.com
 *--------------------------------------------------------------------*/
using System;
/*
All registers are 16 bits.
*/
namespace RegistersX
{
	static class Registers
	{
		//cmd definition 
		public static uint CMD_SYSTEM_RESET = (uint)(1 << 0);
		public static uint CMD_FAULT_RESET = (uint)(1 << 1);
		public static uint CMD_STOP = (uint)(1 << 2);
		public static uint CMD_LVOL_ON = (uint)(1 << 3);
		public static uint CMD_LVOL_OFF = (uint)(1 << 4);
		public static uint CMD_HVOL_ON = (uint)(1 << 5);
		public static uint CMD_HVOL_OFF = (uint)(1 << 6);
		public static uint CMD_TRIG_ON = (uint)(1 << 7);
		public static uint CMD_TRIG_OFF = (uint)(1 << 8);
		public static uint CMD_TRIG_INT = (uint)(1 << 9);
		public static uint CMD_TRIG_EXT = (uint)(1 << 10);
		public static uint CMD_FAULT_ON = (uint)(1 << 11);
		public static uint CMD_FAULT_OFF = (uint)(1 << 12);
		public static uint CMD_READY_SET = (uint)(1 << 13);
		public static uint CMD_READY_RESET = (uint)(1 << 14);
		public static uint CMD_PARAM_RESET = (uint)(1 << 15);
		public static uint CMD_PARAM_SAVE = (uint)(1 << 16);
		public static uint CMD_SWITCHBOX_RESET = (uint)(1 << 17);

		//fault mask  definition
		public static uint FAULT_MASK_ALL = (uint)(1 << 0);
		public static uint FAULT_MASK_SWITCHBOX = (uint)(1 << 1);
		public static uint FAULT_MASK_CHARGE_POWER = (uint)(1 << 2);
		public static uint FAULT_MASK_MMAG_POWER = (uint)(1 << 3);
		public static uint FAULT_MASK_CMAG_POWER = (uint)(1 << 4);
		public static uint FAULT_MASK_HEATER_POWER = (uint)(1 << 5);
		public static uint FAULT_MASK_WATER_OT = (uint)(1 << 6);
		public static uint FAULT_MASK_WATER_UF = (uint)(1 << 7);

		//status0 bit mask definition
		public static uint STATUS0_LVOL_ON = (uint)(1 << 0);
		public static uint STATUS0_READY = (uint)(1 << 1);
		public static uint STATUS0_HVOL_ON = (uint)(1 << 2);
		public static uint STATUS0_TRIG_ON = (uint)(1 << 3);
		public static uint STATUS0_TRIG_SRC = (uint)(1 << 4);
		public static uint STATUS0_LOCK_FAULT = (uint)(1 << 5);
		public static uint STATUS0_FAULT = (uint)(1 << 6);
		public static uint STATUS0_FAULT_SWITCHBOX1 = (uint)(1 << 7);
		public static uint STATUS0_FAULT_SWITCHBOX2 = (uint)(1 << 8);
		public static uint STATUS0_FAULT_SWITCHBOX3 = (uint)(1 << 9);
		public static uint STATUS0_FAULT_MMAG_POWER = (uint)(1 << 10);
		public static uint STATUS0_FAULT_CMAG_POWER = (uint)(1 << 11);
		public static uint STATUS0_FAULT_BMAG_POWER = (uint)(1 << 12);
		public static uint STATUS0_FAULT_HEATER_POWER = (uint)(1 << 13);
		public static uint STATUS0_FAULT_CHARGE_POWER = (uint)(1 << 14);
		public static uint STATUS0_FAULT_PUMP_UV = (uint)(1 << 15);
		public static uint STATUS0_FAULT_PUMP_OC = (uint)(1 << 16);
		public static uint STATUS0_FAULT_PULSE_UC = (uint)(1 << 17);
		public static uint STATUS0_FAULT_PULSE_OC = (uint)(1 << 18);
		public static uint STATUS0_FAULT_FIRE_OCT = (uint)(1 << 19);
		public static uint STATUS0_FAULT_WATER_UF = (uint)(1 << 20);
		public static uint STATUS0_FAULT_WATER_OT = (uint)(1 << 21);
		public static uint STATUS0_FAULT_HARD_STOP = (uint)(1 << 22);
		public static uint STATUS0_FAULT_SOFT_STOP = (uint)(1 << 23);
		public static uint STATUS0_FAULT_CTRL_KEY = (uint)(1 << 24);
		public static uint STATUS0_FAULT_USER_KEY = (uint)(1 << 25);
		public static uint STATUS0_FAULT_NOTRIG = (uint)(1 << 26);
		public static uint STATUS0_FAULT_REV1 = (uint)(1 << 27);
		public static uint STATUS0_FAULT_REV2 = (uint)(1 << 28);
		public static uint STATUS0_FAULT_REV3 = (uint)(1 << 29);

		//status1 bit mask definition for switch box1
		public static uint STATUS1_SWITCHBOX1_OFFLINE = (uint)(1 << 0);
		public static uint STATUS1_SWITCHBOX1_FAULT = (uint)(1 << 1);
		public static uint STATUS1_SWITCHBOX1_BLEED = (uint)(1 << 2);
		public static uint STATUS1_SWITCHBOX1_FAULT_OFF = (uint)(1 << 3);
		public static uint STATUS1_SWITCHBOX1_TRIG_SRC = (uint)(1 << 4);
		public static uint STATUS1_SWITCHBOX1_TRIG_ON = (uint)(1 << 5);
		public static uint STATUS1_SWITCHBOX1_WRITE_LOCK = (uint)(1 << 6);
		public static uint STATUS1_SWITCHBOX1_RESET = (uint)(1 << 7);
		public static uint STATUS1_SWITCHBOX1_PE1 = (uint)(1 << 8);
		public static uint STATUS1_SWITCHBOX1_PE2 = (uint)(1 << 9);
		public static uint STATUS1_SWITCHBOX1_PE3 = (uint)(1 << 10);
		public static uint STATUS1_SWITCHBOX1_PE4 = (uint)(1 << 11);
		public static uint STATUS1_SWITCHBOX1_PE5 = (uint)(1 << 12);
		public static uint STATUS1_SWITCHBOX1_PE6 = (uint)(1 << 13);
		public static uint STATUS1_SWITCHBOX1_OV1 = (uint)(1 << 14);
		public static uint STATUS1_SWITCHBOX1_OV2 = (uint)(1 << 15);
		public static uint STATUS1_SWITCHBOX1_OC1 = (uint)(1 << 16);
		public static uint STATUS1_SWITCHBOX1_OC2 = (uint)(1 << 17);
		public static uint STATUS1_SWITCHBOX1_OC3 = (uint)(1 << 18);
		public static uint STATUS1_SWITCHBOX1_OC4 = (uint)(1 << 19);
		public static uint STATUS1_SWITCHBOX1_OC5 = (uint)(1 << 20);
		public static uint STATUS1_SWITCHBOX1_OC6 = (uint)(1 << 21);
		public static uint STATUS1_SWITCHBOX1_OT = (uint)(1 << 22);
		public static uint STATUS1_SWITCHBOX1_UF = (uint)(1 << 23);
		public static uint STATUS1_SWITCHBOX1_UC1 = (uint)(1 << 24);
		public static uint STATUS1_SWITCHBOX1_UC2 = (uint)(1 << 25);
		public static uint STATUS1_SWITCHBOX1_UC3 = (uint)(1 << 26);
		public static uint STATUS1_SWITCHBOX1_UC4 = (uint)(1 << 27);
		public static uint STATUS1_SWITCHBOX1_UC5 = (uint)(1 << 28);
		public static uint STATUS1_SWITCHBOX1_UC6 = (uint)(1 << 29);
		public static uint STATUS1_SWITCHBOX1_FTIN = (uint)(1 << 30);
		public static uint STATUS1_SWITCHBOX1_NTFT = (uint)(1 << 31);

		//status2 bit mask definition for switch box2
		public static uint STATUS2_SWITCHBOX2_OFFLINE = (uint)(1 << 0);
		public static uint STATUS2_SWITCHBOX2_FAULT = (uint)(1 << 1);
		public static uint STATUS2_SWITCHBOX2_BLEED = (uint)(1 << 2);
		public static uint STATUS2_SWITCHBOX2_FAULT_OFF = (uint)(1 << 3);
		public static uint STATUS2_SWITCHBOX2_TRIG_SRC = (uint)(1 << 4);
		public static uint STATUS2_SWITCHBOX2_TRIG_ON = (uint)(1 << 5);
		public static uint STATUS2_SWITCHBOX2_WRITE_LOCK = (uint)(1 << 6);
		public static uint STATUS2_SWITCHBOX2_RESET = (uint)(1 << 7);
		public static uint STATUS2_SWITCHBOX2_PE1 = (uint)(1 << 8);
		public static uint STATUS2_SWITCHBOX2_PE2 = (uint)(1 << 9);
		public static uint STATUS2_SWITCHBOX2_PE3 = (uint)(1 << 10);
		public static uint STATUS2_SWITCHBOX2_PE4 = (uint)(1 << 11);
		public static uint STATUS2_SWITCHBOX2_PE5 = (uint)(1 << 12);
		public static uint STATUS2_SWITCHBOX2_PE6 = (uint)(1 << 13);
		public static uint STATUS2_SWITCHBOX2_OV1 = (uint)(1 << 14);
		public static uint STATUS2_SWITCHBOX2_OV2 = (uint)(1 << 15);
		public static uint STATUS2_SWITCHBOX2_OC1 = (uint)(1 << 16);
		public static uint STATUS2_SWITCHBOX2_OC2 = (uint)(1 << 17);
		public static uint STATUS2_SWITCHBOX2_OC3 = (uint)(1 << 18);
		public static uint STATUS2_SWITCHBOX2_OC4 = (uint)(1 << 19);
		public static uint STATUS2_SWITCHBOX2_OC5 = (uint)(1 << 20);
		public static uint STATUS2_SWITCHBOX2_OC6 = (uint)(1 << 21);
		public static uint STATUS2_SWITCHBOX2_OT = (uint)(1 << 22);
		public static uint STATUS2_SWITCHBOX2_UF = (uint)(1 << 23);
		public static uint STATUS2_SWITCHBOX2_UC1 = (uint)(1 << 24);
		public static uint STATUS2_SWITCHBOX2_UC2 = (uint)(1 << 25);
		public static uint STATUS2_SWITCHBOX2_UC3 = (uint)(1 << 26);
		public static uint STATUS2_SWITCHBOX2_UC4 = (uint)(1 << 27);
		public static uint STATUS2_SWITCHBOX2_UC5 = (uint)(1 << 28);
		public static uint STATUS2_SWITCHBOX2_UC6 = (uint)(1 << 29);
		public static uint STATUS2_SWITCHBOX2_FTIN = (uint)(1 << 30);
		public static uint STATUS2_SWITCHBOX2_NTFT = (uint)(1 << 31);

		//status3 bit mask definition for switch box3
		public static uint STATUS3_SWITCHBOX3_OFFLINE = (uint)(1 << 0);
		public static uint STATUS3_SWITCHBOX3_FAULT = (uint)(1 << 1);
		public static uint STATUS3_SWITCHBOX3_BLEED = (uint)(1 << 2);
		public static uint STATUS3_SWITCHBOX3_FAULT_OFF = (uint)(1 << 3);
		public static uint STATUS3_SWITCHBOX3_TRIG_SRC = (uint)(1 << 4);
		public static uint STATUS3_SWITCHBOX3_TRIG_ON = (uint)(1 << 5);
		public static uint STATUS3_SWITCHBOX3_WRITE_LOCK = (uint)(1 << 6);
		public static uint STATUS3_SWITCHBOX3_RESET = (uint)(1 << 7);
		public static uint STATUS3_SWITCHBOX3_PE1 = (uint)(1 << 8);
		public static uint STATUS3_SWITCHBOX3_PE2 = (uint)(1 << 9);
		public static uint STATUS3_SWITCHBOX3_PE3 = (uint)(1 << 10);
		public static uint STATUS3_SWITCHBOX3_PE4 = (uint)(1 << 11);
		public static uint STATUS3_SWITCHBOX3_PE5 = (uint)(1 << 12);
		public static uint STATUS3_SWITCHBOX3_PE6 = (uint)(1 << 13);
		public static uint STATUS3_SWITCHBOX3_OV1 = (uint)(1 << 14);
		public static uint STATUS3_SWITCHBOX3_OV2 = (uint)(1 << 15);
		public static uint STATUS3_SWITCHBOX3_OC1 = (uint)(1 << 16);
		public static uint STATUS3_SWITCHBOX3_OC2 = (uint)(1 << 17);
		public static uint STATUS3_SWITCHBOX3_OC3 = (uint)(1 << 18);
		public static uint STATUS3_SWITCHBOX3_OC4 = (uint)(1 << 19);
		public static uint STATUS3_SWITCHBOX3_OC5 = (uint)(1 << 20);
		public static uint STATUS3_SWITCHBOX3_OC6 = (uint)(1 << 21);
		public static uint STATUS3_SWITCHBOX3_OT = (uint)(1 << 22);
		public static uint STATUS3_SWITCHBOX3_UF = (uint)(1 << 23);
		public static uint STATUS3_SWITCHBOX3_UC1 = (uint)(1 << 24);
		public static uint STATUS3_SWITCHBOX3_UC2 = (uint)(1 << 25);
		public static uint STATUS3_SWITCHBOX3_UC3 = (uint)(1 << 26);
		public static uint STATUS3_SWITCHBOX3_UC4 = (uint)(1 << 27);
		public static uint STATUS3_SWITCHBOX3_UC5 = (uint)(1 << 28);
		public static uint STATUS3_SWITCHBOX3_UC6 = (uint)(1 << 29);
		public static uint STATUS3_SWITCHBOX3_FTIN = (uint)(1 << 30);
		public static uint STATUS3_SWITCHBOX3_NTFT = (uint)(1 << 31);

		//status4 bit mask definition for heater power
		public static uint STATUS4_HEATER_POWER_OFFLINE = (uint)(1 << 0);
		public static uint STATUS4_HEATER_POWER_AC = (uint)(1 << 1);
		public static uint STATUS4_HEATER_POWER_OTP = (uint)(1 << 2);
		public static uint STATUS4_HEATER_POWER_FLD = (uint)(1 << 3);
		public static uint STATUS4_HEATER_POWER_OVP = (uint)(1 << 4);
		public static uint STATUS4_HEATER_POWER_SO = (uint)(1 << 5);
		public static uint STATUS4_HEATER_POWER_OFF = (uint)(1 << 6);
		public static uint STATUS4_HEATER_POWER_INT = (uint)(1 << 7);
		public static uint STATUS4_HEATER_POWER_UVP = (uint)(1 << 8);
		public static uint STATUS4_HEATER_POWER_NU1 = (uint)(1 << 9);
		public static uint STATUS4_HEATER_POWER_INPO = (uint)(1 << 10);
		public static uint STATUS4_HEATER_POWER_INTO = (uint)(1 << 11);
		public static uint STATUS4_HEATER_POWER_ITMO = (uint)(1 << 12);
		public static uint STATUS4_HEATER_POWER_ICOM = (uint)(1 << 13);
		public static uint STATUS4_HEATER_POWER_NU2 = (uint)(1 << 14);
		public static uint STATUS4_HEATER_POWER_NU3 = (uint)(1 << 15);
		public static uint STATUS4_HEATER_POWER_CV = (uint)(1 << 16);
		public static uint STATUS4_HEATER_POWER_CC = (uint)(1 << 17);
		public static uint STATUS4_HEATER_POWER_NFL = (uint)(1 << 18);
		public static uint STATUS4_HEATER_POWER_TW = (uint)(1 << 19);
		public static uint STATUS4_HEATER_POWER_AST = (uint)(1 << 20);
		public static uint STATUS4_HEATER_POWER_FBE = (uint)(1 << 21);
		public static uint STATUS4_HEATER_POWER_LSC = (uint)(1 << 22);
		public static uint STATUS4_HEATER_POWER_LOC = (uint)(1 << 23);
		public static uint STATUS4_HEATER_POWER_UVPEN = (uint)(1 << 24);
		public static uint STATUS4_HEATER_POWER_ILCEN = (uint)(1 << 25);
		public static uint STATUS4_HEATER_POWER_NU4 = (uint)(1 << 26);
		public static uint STATUS4_HEATER_POWER_FBC = (uint)(1 << 27);
		public static uint STATUS4_HEATER_POWER_AVP = (uint)(1 << 28);
		public static uint STATUS4_HEATER_POWER_ACP = (uint)(1 << 29);
		public static uint STATUS4_HEATER_POWER_DWE = (uint)(1 << 30);

		//status5 bit mask definition for cmag power
		public static uint STATUS5_CMAG_POWER_OFFLINE = (uint)(1 << 0);
		public static uint STATUS5_CMAG_POWER_AC = (uint)(1 << 1);
		public static uint STATUS5_CMAG_POWER_OTP = (uint)(1 << 2);
		public static uint STATUS5_CMAG_POWER_FLD = (uint)(1 << 3);
		public static uint STATUS5_CMAG_POWER_OVP = (uint)(1 << 4);
		public static uint STATUS5_CMAG_POWER_SO = (uint)(1 << 5);
		public static uint STATUS5_CMAG_POWER_OFF = (uint)(1 << 6);
		public static uint STATUS5_CMAG_POWER_INT = (uint)(1 << 7);
		public static uint STATUS5_CMAG_POWER_UVP = (uint)(1 << 8);
		public static uint STATUS5_CMAG_POWER_NU1 = (uint)(1 << 9);
		public static uint STATUS5_CMAG_POWER_INPO = (uint)(1 << 10);
		public static uint STATUS5_CMAG_POWER_INTO = (uint)(1 << 11);
		public static uint STATUS5_CMAG_POWER_ITMO = (uint)(1 << 12);
		public static uint STATUS5_CMAG_POWER_ICOM = (uint)(1 << 13);
		public static uint STATUS5_CMAG_POWER_NU2 = (uint)(1 << 14);
		public static uint STATUS5_CMAG_POWER_NU3 = (uint)(1 << 15);
		public static uint STATUS5_CMAG_POWER_CV = (uint)(1 << 16);
		public static uint STATUS5_CMAG_POWER_CC = (uint)(1 << 17);
		public static uint STATUS5_CMAG_POWER_NFL = (uint)(1 << 18);
		public static uint STATUS5_CMAG_POWER_TW = (uint)(1 << 19);
		public static uint STATUS5_CMAG_POWER_AST = (uint)(1 << 20);
		public static uint STATUS5_CMAG_POWER_FBE = (uint)(1 << 21);
		public static uint STATUS5_CMAG_POWER_LSC = (uint)(1 << 22);
		public static uint STATUS5_CMAG_POWER_LOC = (uint)(1 << 23);
		public static uint STATUS5_CMAG_POWER_UVPEN = (uint)(1 << 24);
		public static uint STATUS5_CMAG_POWER_ILCEN = (uint)(1 << 25);
		public static uint STATUS5_CMAG_POWER_NU4 = (uint)(1 << 26);
		public static uint STATUS5_CMAG_POWER_FBC = (uint)(1 << 27);
		public static uint STATUS5_CMAG_POWER_AVP = (uint)(1 << 28);
		public static uint STATUS5_CMAG_POWER_ACP = (uint)(1 << 29);
		public static uint STATUS5_CMAG_POWER_DWE = (uint)(1 << 30);

		//status6 bit mask definition for mmag power
		public static uint STATUS6_MMAG_POWER_ST0 = (uint)(1 << 0);
		public static uint STATUS6_MMAG_POWER_ST1 = (uint)(1 << 1);
		public static uint STATUS6_MMAG_POWER_ST2 = (uint)(1 << 2);
		public static uint STATUS6_MMAG_POWER_ST3 = (uint)(1 << 3);
		public static uint STATUS6_MMAG_POWER_ST4 = (uint)(1 << 4);
		public static uint STATUS6_MMAG_POWER_ST5 = (uint)(1 << 5);
		public static uint STATUS6_MMAG_POWER_ST6 = (uint)(1 << 6);
		public static uint STATUS6_MMAG_POWER_ST7 = (uint)(1 << 7);
		public static uint STATUS6_MMAG_POWER_OFFLINE = (uint)(1 << 8);
		public static uint STATUS6_MMAG_POWER_ST9 = (uint)(1 << 9);
		public static uint STATUS6_MMAG_POWER_ST10 = (uint)(1 << 10);
		public static uint STATUS6_MMAG_POWER_ST11 = (uint)(1 << 11);
		public static uint STATUS6_MMAG_POWER_ST12 = (uint)(1 << 12);
		public static uint STATUS6_MMAG_POWER_ST13 = (uint)(1 << 13);
		public static uint STATUS6_MMAG_POWER_ST14 = (uint)(1 << 14);
		public static uint STATUS6_MMAG_POWER_ST15 = (uint)(1 << 15);
		public static uint STATUS6_MMAG_POWER_OUC = (uint)(1 << 16);
		public static uint STATUS6_MMAG_POWER_OOC = (uint)(1 << 17);
		public static uint STATUS6_MMAG_POWER_OOV = (uint)(1 << 18);
		public static uint STATUS6_MMAG_POWER_DCCT = (uint)(1 << 19);
		public static uint STATUS6_MMAG_POWER_DCSFT = (uint)(1 << 20);
		public static uint STATUS6_MMAG_POWER_OT = (uint)(1 << 21);
		public static uint STATUS6_MMAG_POWER_LPFT = (uint)(1 << 22);
		public static uint STATUS6_MMAG_POWER_PE = (uint)(1 << 23);
		public static uint STATUS6_MMAG_POWER_NU1 = (uint)(1 << 24);
		public static uint STATUS6_MMAG_POWER_NU2 = (uint)(1 << 25);
		public static uint STATUS6_MMAG_POWER_BP = (uint)(1 << 26);
		public static uint STATUS6_MMAG_POWER_IUV = (uint)(1 << 27);
		public static uint STATUS6_MMAG_POWER_IOV = (uint)(1 << 28);
		public static uint STATUS6_MMAG_POWER_INFT1 = (uint)(1 << 29);
		public static uint STATUS6_MMAG_POWER_INFT2 = (uint)(1 << 30);
		public static uint STATUS6_MMAG_POWER_SDFT = (uint)(1 << 31);

		//status7 bit mask definition for charge power
		public static uint STATUS7_CHARGE_POWER_LV = (uint)(1 << 0);
		public static uint STATUS7_CHARGE_POWER_READY = (uint)(1 << 1);
		public static uint STATUS7_CHARGE_POWER_HV = (uint)(1 << 2);
		public static uint STATUS7_CHARGE_POWER_LOCAL = (uint)(1 << 3);
		public static uint STATUS7_CHARGE_POWER_FAULT = (uint)(1 << 4);
		public static uint STATUS7_CHARGE_POWER_SAFETY = (uint)(1 << 5);
		public static uint STATUS7_CHARGE_POWER_IGBT_OC = (uint)(1 << 6);
		public static uint STATUS7_CHARGE_POWER_OV = (uint)(1 << 7);
		public static uint STATUS7_CHARGE_POWER_OT = (uint)(1 << 8);
		public static uint STATUS7_CHARGE_POWER_WATER = (uint)(1 << 9);
		public static uint STATUS7_CHARGE_POWER_LACK = (uint)(1 << 10);
		public static uint STATUS7_CHARGE_POWER_FAN = (uint)(1 << 11);
		public static uint STATUS7_CHARGE_POWER_OC = (uint)(1 << 12);
		public static uint STATUS7_CHARGE_POWER_SLAVE = (uint)(1 << 13);
		public static uint STATUS7_CHARGE_POWER_INHIBIT = (uint)(1 << 14);
		public static uint STATUS7_CHARGE_POWER_VMODE = (uint)(1 << 15);
		public static uint STATUS7_CHARGE_POWER_CMODE = (uint)(1 << 16);
		public static uint STATUS7_CHARGE_POWER_EOC = (uint)(1 << 17);
		public static uint STATUS7_CHARGE_POWER_CTTR = (uint)(1 << 18);
		public static uint STATUS7_CHARGE_POWER_OFFLINE = (uint)(1 << 19);

		/*********************************************
		 *       registers definition
		 *********************************************/
		/*---------nvd registers start-----------*/
		public static ushort NVD_REG_START = 0;
		/* magic registers group */
		public static ushort MAGIC_REG_START = 0;
		public static ushort REG_MAGIC_ID_L = 0;
		public static ushort REG_MAGIC_ID_H = 1;
		public static ushort MAGIC_REG_END = 1;
		/* config registers group */
		public static ushort CONFIG_REG_START = 2;
		public static ushort REG_CONFIG_ETH_HOSTIP_L = 2;
		public static ushort REG_CONFIG_ETH_HOSTIP_H = 3;
		public static ushort REG_CONFIG_ETH_GATEWAY_L = 4;
		public static ushort REG_CONFIG_ETH_GATEWAY_H = 5;
		public static ushort REG_CONFIG_ETH_MASK_L = 6;
		public static ushort REG_CONFIG_ETH_MASK_H = 7;
		public static ushort REG_CONFIG_TCP_CLIENT_RIP_L = 8;
		public static ushort REG_CONFIG_TCP_CLIENT_RIP_H = 9;
		public static ushort REG_CONFIG_TCP_CLIENT_RPORT = 10;
		public static ushort REG_CONFIG_TCP_CLIENT_LPORT = 11;
		public static ushort REG_CONFIG_TCP_SERVER_LPORT = 12;
		public static ushort REG_CONFIG_RS4851_L = 13;
		public static ushort REG_CONFIG_RS4851_H = 14;
		public static ushort REG_CONFIG_RS4852_L = 15;
		public static ushort REG_CONFIG_RS4852_H = 16;
		public static ushort REG_CONFIG_MODBUS_ID = 17;
		public static ushort CONFIG_REG_END = 17;
		/* param registers group */
		public static ushort PARAM_REG_START = 18;
		public static ushort REG_PARAM_DS18B20_0_ROM_0 = 18;
		public static ushort REG_PARAM_DS18B20_0_ROM_1 = 19;
		public static ushort REG_PARAM_DS18B20_0_ROM_2 = 20;
		public static ushort REG_PARAM_DS18B20_0_ROM_3 = 21;
		public static ushort REG_PARAM_DS18B20_1_ROM_0 = 22;
		public static ushort REG_PARAM_DS18B20_1_ROM_1 = 23;
		public static ushort REG_PARAM_DS18B20_1_ROM_2 = 24;
		public static ushort REG_PARAM_DS18B20_1_ROM_3 = 25;
		public static ushort REG_PARAM_DS18B20_2_ROM_0 = 26;
		public static ushort REG_PARAM_DS18B20_2_ROM_1 = 27;
		public static ushort REG_PARAM_DS18B20_2_ROM_2 = 28;
		public static ushort REG_PARAM_DS18B20_2_ROM_3 = 29;
		public static ushort REG_PARAM_DS18B20_3_ROM_0 = 30;
		public static ushort REG_PARAM_DS18B20_3_ROM_1 = 31;
		public static ushort REG_PARAM_DS18B20_3_ROM_2 = 32;
		public static ushort REG_PARAM_DS18B20_3_ROM_3 = 33;
		public static ushort REG_PARAM_IN_PIN_REV = 34;
		public static ushort REG_PARAM_OUT_PIN_REV = 35;
		public static ushort REG_PARAM_PULSE_VOL = 36;   //0.1kV
		public static ushort REG_PARAM_PULSE_WIDTH = 37;   //0.1us
		public static ushort REG_PARAM_PULSE_FREQ = 38;   //1Hz
		public static ushort REG_PARAM_HEATER_CUR = 39;   //0.1A
		public static ushort REG_PARAM_MMAG_CUR = 40;   //0.1A
		public static ushort REG_PARAM_CMAG_CUR = 41;   //0.1A
		public static ushort REG_PARAM_HEATER_RATE = 42;   //0.01A/s
		public static ushort REG_PARAM_TRIG_DELAY = 43;   //0.1us
		public static ushort REG_PARAM_PREHEAT_TIME = 44;   //sec
		public static ushort REG_PARAM_WATER_TTHR = 45;   //0.01deg
		public static ushort REG_PARAM_WATER_FTHR = 46;   //0.01L/min
		public static ushort REG_PARAM_FIRE_CTHR = 47;
		public static ushort REG_PARAM_HVOL_TCT_L = 48;   //sec
		public static ushort REG_PARAM_HVOL_TCT_H = 49;   //sec
		public static ushort REG_PARAM_LVOL_TCT_L = 50;   //sec
		public static ushort REG_PARAM_LVOL_TCT_H = 51;   //sec
		public static ushort REG_PARAM_TRANS_RATIO = 52;   //0.1
		public static ushort REG_PARAM_LOAD_IMP = 53;   //ohm
		public static ushort REG_PARAM_SWITCHBOX1_DT_L = 54;
		public static ushort REG_PARAM_SWITCHBOX1_DT_H = 55;
		public static ushort REG_PARAM_SWITCHBOX2_DT_L = 56;
		public static ushort REG_PARAM_SWITCHBOX2_DT_H = 57;
		public static ushort REG_PARAM_SWITCHBOX3_DT_L = 58;
		public static ushort REG_PARAM_SWITCHBOX3_DT_H = 59;
		public static ushort REG_PARAM_FAULT_MASK = 60;
		public static ushort NVD_REG_END = 60;
		/*---------nvd registers end-----------*/

		/* cmd registers group */
		public static ushort CMD_REG_START = 61;
		public static ushort REG_CMD_L = 61;
		public static ushort REG_CMD_H = 62;
		public static ushort CMD_REG_END = 62;
		/* status registers group */
		public static ushort STATUS_REG_START = 63;
		public static ushort REG_STATUS_0_L = 63;
		public static ushort REG_STATUS_0_H = 64;
		public static ushort REG_STATUS_1_L = 65;
		public static ushort REG_STATUS_1_H = 66;
		public static ushort REG_STATUS_2_L = 67;
		public static ushort REG_STATUS_2_H = 68;
		public static ushort REG_STATUS_3_L = 69;
		public static ushort REG_STATUS_3_H = 70;
		public static ushort REG_STATUS_4_L = 71;
		public static ushort REG_STATUS_4_H = 72;
		public static ushort REG_STATUS_5_L = 73;
		public static ushort REG_STATUS_5_H = 74;
		public static ushort REG_STATUS_6_L = 75;
		public static ushort REG_STATUS_6_H = 76;
		public static ushort REG_STATUS_7_L = 77;
		public static ushort REG_STATUS_7_H = 78;
		public static ushort STATUS_REG_END = 78;
		/* data registers group */
		public static ushort DATA_REG_START = 79;
		public static ushort REG_DATA_PULSE_VOL = 79;   //0.1kV
		public static ushort REG_DATA_PULSE_CUR = 80;   //0.1A
		public static ushort REG_DATA_PULSE_FREQ = 81;   //1Hz
		public static ushort REG_DATA_PULSE_WIDTH = 82;   //0.1us
		public static ushort REG_DATA_CHARGE_VOL = 83;   //0.1V
		public static ushort REG_DATA_CHARGE_CUR = 84;   //0.1A
		public static ushort REG_DATA_HEATER_VOL = 85;   //0.1V
		public static ushort REG_DATA_HEATER_CUR = 86;   //0.1A
		public static ushort REG_DATA_MMAG_VOL = 87;   //0.1V
		public static ushort REG_DATA_MMAG_CUR = 88;   //0.1A
		public static ushort REG_DATA_CMAG_VOL = 89;   //0.1V
		public static ushort REG_DATA_CMAG_CUR = 90;   //0.1A
		public static ushort REG_DATA_WATER_TEMP_1 = 91;   //0.01deg
		public static ushort REG_DATA_WATER_TEMP_2 = 92;   //0.01deg
		public static ushort REG_DATA_WATER_TEMP_3 = 93;   //0.01deg
		public static ushort REG_DATA_WATER_TEMP_4 = 94;   //0.01deg
		public static ushort REG_DATA_WATER_FLOW_1 = 95;   //0.01L/min
		public static ushort REG_DATA_WATER_FLOW_2 = 96;   //0.01L/min
		public static ushort REG_DATA_WATER_FLOW_3 = 97;   //0.01L/min
		public static ushort REG_DATA_WATER_FLOW_4 = 98;   //0.01L/min
		public static ushort REG_DATA_HVOL_TCT_L = 99;   //sec
		public static ushort REG_DATA_HVOL_TCT_H = 100;   //sec
		public static ushort REG_DATA_LVOL_TCT_L = 101;   //sec
		public static ushort REG_DATA_LVOL_TCT_H = 102;   //sec
		public static ushort REG_DATA_HVOL_CT_L = 103;   //sec
		public static ushort REG_DATA_HVOL_CT_H = 104;   //sec
		public static ushort REG_DATA_LVOL_CT_L = 105;   //sec
		public static ushort REG_DATA_LVOL_CT_H = 106;   //sec
		public static ushort REG_DATA_PREHEAT_CTD = 107;   //sec
		public static ushort REG_DATA_FIRE_CT = 108;
		public static ushort REG_DATA_SYSTIME_L = 109;   //sec
		public static ushort REG_DATA_SYSTIME_H = 110;   //sec
		public static ushort DATA_REG_END = 110;
		/*
		*/
		public static ushort REG_NUMBER = 111;
		public static ushort NVD_REG_NUMBER = 61;
		/*
		*/
		public static ushort[] regTable = new ushort[REG_NUMBER];
		public static ushort[ , ] nvdRegTable = new ushort[NVD_REG_NUMBER, 3]{
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)120, (ushort)-1600, (ushort)1600},
			{(ushort)30, (ushort)10, (ushort)60},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
			{(ushort)0, (ushort)0, (ushort)0},
		};
		/*
		*/
		public void NvdRegReset()
		{
			for(int i = NVD_REG_START; i <= NVD_REG_END; i++) {
				regTable[i] = nvdRegTable[i - NVD_REG_START, 0];
			}
		}
		/*
		*/
		public void NvdRegLimit(int addr, ushort data)
		{
			int index = addr - NVD_REG_START;
			if(data < nvdRegTable[index, 1]) {
				data = nvdRegTable[index, 1];
			} else if(data > nvdRegTable[index, 2]) {
				data = nvdRegTable[index, 2];
			}
		}
		/*
		*/
		public void NvdRegLimit(int addr, short data)
		{
			int index = addr - NVD_REG_START;
			if(data < (short)nvdRegTable[index, 1]) {
				data = (short)nvdRegTable[index, 1];
			} else if(data > (short)nvdRegTable[index, 2]) {
				data = (short)nvdRegTable[index, 2];
			}
		}
		/*
		*/
		public static void SetAll(ushort val)
		{
			for(int i = 0; i < REG_NUMBER; i++)
			{
				regTable[i] = val;
			}
		}
		/*
		*/
		public static ushort Reg16Read(int addr)
		{
			return regTable[addr];
		}
		/*
		*/
		public static UInt32 Reg32Read(int addr)
		{
			return ((uint)regTable[addr + 1] << 16) + (uint)regTable[addr];
		}
		/*
		*/
		public static UInt64 Reg48Read(int addr)
		{
			return ((UInt64)regTable[addr + 2] << 32) +
			       ((UInt64)regTable[addr + 1] << 16) +
			        (UInt64)regTable[addr];
		}
		/*
		*/
		public static UInt64 Reg64Read(int addr)
		{
			return ((UInt64)regTable[addr + 3] << 48) +
			       ((UInt64)regTable[addr + 2] << 32) +
			       ((UInt64)regTable[addr + 1] << 16) +
			        (UInt64)regTable[addr];
		}
		/*
		*/
		public static void Reg16Write(int addr, ushort data)
		{
			regTable[addr] = data;
		}
		/*
		*/
		public static void Reg32Write(int addr, UInt32 data)
		{
			regTable[addr] = (ushort)data;
			regTable[addr + 1] = (ushort)(data >> 16);
		}
		/*
		*/
		public static void Reg48Write(int addr, UInt64 data)
		{
			regTable[addr] = (ushort)data;
			regTable[addr + 1] = (ushort)(data >> 16);
			regTable[addr + 2] = (ushort)(data >> 32);
		}
		/*
		*/
		public static void Reg64Write(int addr, UInt64 data)
		{
			regTable[addr] = (ushort)data;
			regTable[addr + 1] = (ushort)(data >> 16);
			regTable[addr + 2] = (ushort)(data >> 32);
			regTable[addr + 3] = (ushort)(data >> 48);
		}
	}
}
